package com.oba.king.businessprocess.sendordermanage;

import com.oba.base.service.BaseBo;
import com.oba.king.controlmanage.proxyproduct.ProxyProductDetails;
import com.oba.king.datalib.productinfo.ProductInfo;

public class OrderProductDetails extends BaseBo{

	private OrderApply orderApply;
	private ProductInfo productinfo;
	private String measureUnit;
	private Integer amount;
	private Double totalSum;
	private ProxyProductDetails proxyProduct;
	
	public Long getId() {
		return productinfo.getId();
	}

	public String getName() {
		return null;
	}
	

	@Override
	public int hashCode() {
		int result = 31;
		result = result * 19 + (productinfo == null ? 0 : productinfo.hashCode());
		result = result * 19 + (orderApply == null ? 0 : orderApply.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}
		if (!(obj instanceof OrderProductDetails)) {
			return false;
		}
		OrderProductDetails old = (OrderProductDetails) obj;
		if(this.isNewBo() && old.productinfo != null && this.productinfo != null) {
			return this.productinfo.equals(old.productinfo);
		}
		if (old.productinfo == null || old.orderApply == null || this.productinfo == null || this.orderApply == null) {
			return false;
		} else if (old.productinfo.getProductId() != null && old.productinfo.getProductId() == this.productinfo.getProductId()
				&& old.orderApply.getOrderId() != null
				&& old.orderApply.getOrderId() == this.orderApply.getOrderId()) {
			return true;
		}
		return false;
	}
	public OrderApply getOrderApply() {
		return orderApply;
	}

	public void setOrderApply(OrderApply orderApply) {
		this.orderApply = orderApply;
	}


	public String getMeasureUnit() {
		return measureUnit;
	}

	public void setMeasureUnit(String measureUnit) {
		this.measureUnit = measureUnit;
	}

	public Integer getAmount() {
		return amount;
	}

	public void setAmount(Integer amount) {
		this.amount = amount;
	}

	public Double getTotalSum() {
		return totalSum;
	}

	public void setTotalSum(Double totalSum) {
		this.totalSum = totalSum;
	}

	public ProductInfo getProductinfo() {
		return productinfo;
	}

	public void setProductinfo(ProductInfo productinfo) {
		this.productinfo = productinfo;
	}

	public ProxyProductDetails getProxyProduct() {
		return proxyProduct;
	}

	public void setProxyProduct(ProxyProductDetails proxyProduct) {
		this.proxyProduct = proxyProduct;
	}

}
